﻿using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WPF.Project.Demo.Common.Models;

namespace WPF.Project.Demo.ViewModels
{
    /// <summary>
    /// 备忘录
    /// </summary>
    public class MemoViewModel : BindableBase
    { 
        public MemoViewModel()
        {
            MemoDtos = new ObservableCollection<MemoDto>();
            CreateToDoList();
            AddCommnd = new DelegateCommand(Add);
        }


        private bool isRightDrawerOpen;
        public bool IsRightDrawerOpen
        {
            get { return isRightDrawerOpen; }
            set { isRightDrawerOpen = value; RaisePropertyChanged(); }
        }

        private void Add()
        {
            IsRightDrawerOpen = true;
        }

        public DelegateCommand AddCommnd { get; set; }

        ObservableCollection<MemoDto> memoDtos;
        public ObservableCollection<MemoDto> MemoDtos
        {
            get { return memoDtos; }
            set { memoDtos = value; RaisePropertyChanged(); }
        }

        void CreateToDoList()
        {
            for (int i = 0; i < 25; i++)
            {
                MemoDtos.Add(new MemoDto { Id = i, Title = "备忘录" + i, Content = "测试数据" });
            }
        }
    }
}
